<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style>
			#box{
				width: 300px;
				height: 200px;
				border: 1px solid #000000;
			}
		</style>
	</head>
	<body>
		<div>
			<ul class="mainBoxList">
				
			</ul>
		</div>
		

		<script src="js/ajax.js"></script>
		<script src="js/jquery.js"></script>
		<script>
			onload = function(){
			loadData()
		}
			async function loadData(){
			var data = await Ajax('GET','http://39.105.192.164:9090/apitest/goodslist','');
			var doc = JSON.parse(data)
			console.log(doc)
			renderData(doc)
			
		}
		
		function renderData(doc){

		var str ="";
		for(var i=0;i<doc.data.list.length;i++){


		str +=`
			<li> <a id="${doc.data.list[i].id}" href="http://localhost/jiuxianwang/html/goods.html?id=${doc.data.list[i].id}"><img src=${doc.data.list[i].pic}></a>
				<h5>${doc.data.list[i].name}</h5>
				<p>价格:￥${doc.data.list[i].price}</p>
			</li>    
		`;

		$('.mainBoxList').html(str)

		} 

		}
		</script>
	</body>
</html>
